import 'package:fate_blind_box/config/app_style.dart';
import 'package:fate_blind_box/routes/page_route_names.dart';
import 'package:fate_blind_box/widget/appbar.dart';
import 'package:fate_blind_box/widget/code_input.dart';
import 'package:fate_blind_box/widget/section_title.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'logic.dart';

/// 设置支付密码页面
class SetPayPasswordPage extends GetView<SetPayPasswordLogic> {
  const SetPayPasswordPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.white,
        appBar: const HzAppBar(),
        body: _buildUI());
  }

  /// 构建UI
  Widget _buildUI() {
    return Padding(
      padding: const EdgeInsets.only(top: 24, left: 30, right: 30),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const SectionTitleView(
            '设置支付密码',
            size: 22,
          ),
          const SizedBox(
            height: 12,
          ),
          Text(
            '请设置新的支付密码',
            style: TextStyle(
              color: '1D2129'.stringToColor,
              fontSize: 18,
              fontWeight: FontWeight.w500,
            ),
          ),
          const SizedBox(
            height: 40,
          ),
          _buildVerificationCodeInputWidget(),
        ],
      ),
    );
  }

  /// 密码的输入框
  Widget _buildVerificationCodeInputWidget() {
    return CodeInputWidget(
      obscureText: true,
      obscuringCharacter: '·',
      onSubmitted: (String value) {
        Get.offAndToNamed(PageRouteNames.confirmPaymentPassword, arguments: {
          'lastInputPassword': value,
        });
        // HzNavigator.pushReplacement(SettingRouter.affirmPayPasswordPage, arguments: {
        //   'status': status,
        //   'passWord': value,
        //   'oldPassword': oldPassword,
        //   'signature': signature,
        // });
      },
    );
  }
}
